//
//  HomepageCell.m
//  Blank
//
//  Created by 马博 on 15/9/28.
//  Copyright © 2015年 dllo. All rights reserved.
//

#import "HomepageCell.h"

#define windth [UIScreen mainScreen].bounds.size.width / 375
#define height ([UIScreen mainScreen].bounds.size.height > 568 ? [UIScreen mainScreen].bounds.size.height : 568) / 667

@implementation HomepageCell
/* 重写初始化方法 */
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        
        
        /* 初始化子控件, 子控件的frame属性，在其他方法中设置 */
        self.leftView = [[UIImageView alloc] init];
        
        /* 注意: 子控件添加在 cell的contentView 上面 */
        [self.contentView addSubview:self.leftView];
        
        self.themeLabel = [[UILabel alloc] init];
        [self.contentView addSubview:self.themeLabel];
        
        self.timeLabel = [[UILabel alloc] init];
        [self.contentView addSubview:self.timeLabel];
        
        self.siteLable = [[UILabel alloc] init];
        [self.contentView addSubview:self.siteLable];
        
    }
    return self;
}


/* 布局子视图 */
- (void)layoutSubviews
{
    [super layoutSubviews];
    
    /* 设置子控件的 frame 属性 */
    self.leftView.frame = CGRectMake(windth * 10, height * 10, windth * 90, height * 80);
    
    self.themeLabel.frame = CGRectMake(windth * 130, height * 5, windth * (375 - 150), height * 70);
    self.themeLabel.textColor = [UIColor darkGrayColor];
    self.themeLabel.numberOfLines = 0;
    self.themeLabel.font = [UIFont boldSystemFontOfSize:15];
    
    
    self.timeLabel.frame = CGRectMake(windth * 130, height * 70, windth * 130, height * 30);
    self.timeLabel.font = [UIFont fontWithName:@"Marker Felt" size:15];
    self.timeLabel.textColor = [UIColor grayColor];
    
    self.siteLable.frame = CGRectMake(windth * 280, height* 70, windth * 75, height* 30);
    self.siteLable.textColor = [UIColor grayColor];
    
    self.siteLable.textAlignment = NSTextAlignmentRight;
    self.siteLable.font = [UIFont systemFontOfSize:15];
    
    //夜间
    if ([NightModel getColorModel]) {
        self.themeLabel.backgroundColor = [UIColor grayColor];
        self.themeLabel.textColor = [UIColor whiteColor];
        self.siteLable.backgroundColor = [UIColor grayColor];
        self.siteLable.textColor = [UIColor whiteColor];
        self.timeLabel.backgroundColor = [UIColor grayColor];
        self.timeLabel.textColor = [UIColor whiteColor];
        self.contentView.backgroundColor = [UIColor grayColor];
        
    }
    else{
        //白天
        self.themeLabel.backgroundColor = [UIColor whiteColor];
        self.themeLabel.textColor = [UIColor blackColor];
        self.siteLable.backgroundColor = [UIColor whiteColor];
        self.siteLable.textColor = [UIColor blackColor];
        self.timeLabel.backgroundColor = [UIColor whiteColor];
        self.timeLabel.textColor = [UIColor grayColor];
        self.contentView.backgroundColor = [UIColor whiteColor];
        
    }
    

    
}




- (void)setHomemodel:(HotModel *)homemodel{
    if (_homemodel != homemodel) {

    }
    
}





- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
